﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:common="clr-namespace:Brjnk.Common;assembly=Common"
                    xmlns:controls="clr-namespace:Brjnk.GpxExplorer.UI.Controls"
                    xmlns:data="clr-namespace:Brjnk.GpxExplorer.Data"
                    xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
                    xmlns:layers="clr-namespace:Brjnk.CoordinateSystem2D.Layers;assembly=CoordinateSystem2D"
                    xmlns:local="clr-namespace:Brjnk.GpxExplorer"
                    xmlns:my="clr-namespace:Brjnk.GpxExplorer.UI"
                    xmlns:searching="clr-namespace:Brjnk.GpxExplorer.Workspace.Searching"
                    xmlns:ui="clr-namespace:Brjnk.Common.UI;assembly=Common"
                    xmlns:vm="clr-namespace:Brjnk.GpxExplorer.ViewModel"
                    xmlns:workspace="clr-namespace:Brjnk.GpxExplorer.Workspace">

    <DataTemplate x:Key="AreaSearchRequestMenuTemplate">
        <MenuItem Command="{Binding Source={workspace:GetWorkspace},
                                    Path=SearchService.RemoveItemCommand}"
                  CommandParameter="{Binding}"
                  Header="{l:Loc Key=removeParam,
                                 Binding={Binding StringRepresentation}}" />
    </DataTemplate>

    <DataTemplate x:Key="AreaSearchResultMenuTemplate">
        <MenuItem Command="{Binding Source={workspace:GetWorkspace},
                                    Path=SearchService.RemoveItemCommand}"
                  CommandParameter="{Binding SearchedItem}"
                  Header="{l:Loc Key=removeParam,
                                 Binding={Binding SearchedItem.StringRepresentation}}" />
    </DataTemplate>

    <DataTemplate x:Key="AreaWaypointMenuTemplate">
        <StackPanel>
        <MenuItem Command="{StaticResource SelectCommand}"
                                  CommandParameter="{Binding}"
                                  Header="{Binding Source.Name}">
            <MenuItem.Icon>
                <Image Width="16"
                                       Height="16"
                                       Source="/Resources/Icons/Waypoint.png" />
            </MenuItem.Icon>
        </MenuItem>
            <my:GoToCoordinatesPanel HorizontalAlignment="Right"
                                         ButtonAddPushpin="False"
                                         ButtonAddPushpinAndGoTo="False"
                                         ButtonAddPushpinAndGoToBigZoom="False"
                                         ButtonCopyToClipboard="True"
                                         ButtonCreateWaypoint="false"
                                         ButtonGoTo="False"
                                         ButtonGoToBigZoom="False"
                                         PointObject="{Binding}"  />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="AreaRouteMenuTemplate">
        <StackPanel>
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Margin" Value="1" />
                </Style>
            </StackPanel.Resources>
            <MenuItem Command="{StaticResource SelectCommand}" CommandParameter="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject, RelativeSource={RelativeSource Mode=Self}}">
                <MenuItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Source.Name}" />
                        <controls:HighlightedTextBlock Margin="10 0 0 0"
                                                       VerticalAlignment="Center"
                                                       Text="{Binding RelativeSource={RelativeSource Mode=Self},
                                                                      Path=(layers:GraphLayer.NearestPoint).DataObject.Number}" />
                    </StackPanel>
                </MenuItem.Header>
                <MenuItem.Icon>
                    <Image Width="16"
                           Height="16"
                           Source="/Resources/Icons/Route.png" />
                </MenuItem.Icon>
            </MenuItem>
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                <my:GoToCoordinatesPanel ButtonAddPushpin="False"
                                         ButtonAddPushpinAndGoTo="False"
                                         ButtonAddPushpinAndGoToBigZoom="False"
                                         ButtonCopyToClipboard="True"
                                         ButtonCreateWaypoint="True"
                                         ButtonGoTo="False"
                                         ButtonGoToBigZoom="False"
                                         PointObject="{Binding RelativeSource={RelativeSource Mode=Self},
                                                               Path=(layers:GraphLayer.NearestPoint).DataObject}" />
                <Button MinWidth="0"
                        Margin="1"
                        Command="{Binding Source={workspace:GetWorkspace},
                                          Path=Editor.RemoveRoutePointsCommand}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},
                                                   Path=(layers:GraphLayer.NearestPoint).DataObject}"
                        ToolTip="{l:Loc rtePointRemove}">
                    <Image Width="16"
                           Height="16"
                           Source="/Resources/Icons/remove16.png" />
                </Button>
                <Button MinWidth="0"
                        Margin="1"
                        Command="{Binding Source={workspace:GetWorkspace},
                                          Path=Editor.RouteInsertAfterCommand}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},
                                                   Path=(layers:GraphLayer.PreviousPoint).DataObject}"
                        ToolTip="{l:Loc rteInsertPoint}">
                    <Image Width="16"
                           Height="16"
                           Source="/Resources/Icons/Insert.png" />
                </Button>
            </StackPanel>
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="AreaTrackMenuTemplate">
        <StackPanel>
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Margin" Value="1" />
                </Style>
            </StackPanel.Resources>
            <MenuItem Command="{StaticResource SelectCommand}" CommandParameter="{Binding Path=(layers:GraphLayer.NearestPoint).DataObject, RelativeSource={RelativeSource Mode=Self}}">
                <MenuItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Source.Name}" />
                        <controls:HighlightedTextBlock Margin="10 0 0 0"
                                                       VerticalAlignment="Center"
                                                       Text="{Binding RelativeSource={RelativeSource Mode=Self},
                                                                      Path=(layers:GraphLayer.NearestPoint).DataObject.Number}" />
                    </StackPanel>
                </MenuItem.Header>
                <MenuItem.Icon>
                    <Image Width="16"
                           Height="16"
                           Source="/Resources/Icons/Track.png" />
                </MenuItem.Icon>
            </MenuItem>
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                <my:GoToCoordinatesPanel ButtonAddPushpin="False"
                                         ButtonAddPushpinAndGoTo="False"
                                         ButtonAddPushpinAndGoToBigZoom="False"
                                         ButtonCopyToClipboard="True"
                                         ButtonCreateWaypoint="True"
                                         ButtonGoTo="False"
                                         ButtonGoToBigZoom="False"
                                         PointObject="{Binding RelativeSource={RelativeSource Mode=Self},
                                                               Path=(layers:GraphLayer.NearestPoint).DataObject}" />
                <Button MinWidth="0"
                        Margin="0"
                        Command="{Binding Source={workspace:GetWorkspace},
                                          Path=Editor.RemoveTrackPointsCommand}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},
                                                   Path=(layers:GraphLayer.NearestPoint).DataObject}"
                        ToolTip="{l:Loc trkPointRemove}">
                    <Image Width="16"
                           Height="16"
                           Source="/Resources/Icons/remove16.png" />
                </Button>
                <Button MinWidth="0"
                        Margin="0"
                        Command="{Binding Source={workspace:GetWorkspace},
                                          Path=Editor.TrackInsertAfterCommand}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},
                                                   Path=(layers:GraphLayer.PreviousPoint).DataObject}"
                        ToolTip="{l:Loc trkInsertPoint}">
                    <Image Width="16"
                           Height="16"
                           Source="/Resources/Icons/Insert.png" />
                </Button>
            </StackPanel>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>